{template '_header'}

<div class="page-heading"> 
    <span class='pull-right'>
        {ifp 'sns.category.add'}
        	<a class="btn btn-primary btn-sm" href="{php echo webUrl('sns/category/add')}">添加新分类</a>
        {/if}


    </span>
    <h2>版块分类</h2> 
</div>

{if count($list)>0}
<form action="" method="post">

    <table class="table table-hover table-responsive">
        <thead class="navbar-inner">
            <tr>
                <th style="width:50px;">ID</th>
                <th style='width:80px'>显示顺序</th>					
                <th>标题</th>
                <th>状态</th>
                <th >操作</th>
            </tr>
        </thead>
        <tbody id="sort">
            {loop $list $row}
            <tr>
                <td>{$row['id']}</td>
                <td>
                    {ifp 'sns.category.edit'}
                    	<a href='javascript:;' data-toggle='ajaxEdit' data-href="{php echo webUrl('sns/category/displayorder',array('id'=>$row['id']))}" >{$row['displayorder']}</a>
                    {else}
                    	{$row['displayorder']} 
                    {/if}
                </td>

                <td><img src='{php echo tomedia($row['thumb'])}' style='width:30px;height:30px;padding:1px;border:1px solid #ccc' /> {$row['name']}</td>
                <td>
                    <span class='label {if $row['enabled']==1}label-success{else}label-default{/if}' 
                          {ifp 'sns.category.edit'}
	                          data-toggle='ajaxSwitch' 
	                          data-switch-value='{$row['enabled']}'
	                          data-switch-value0='0|隐藏|label label-default|{php echo webUrl('sns/category/enabled',array('enabled'=>1,'id'=>$row['id']))}'  
	                          data-switch-value1='1|显示|label label-success|{php echo webUrl('sns/category/enabled',array('enabled'=>0,'id'=>$row['id']))}'  
                          {/if}
                          >
                          {if $row['enabled']==1}显示{else}隐藏{/if}</span>
                    </td>
                    <td style="text-align:left;">
                        {ifp 'sns.category.view|sns.category.edit'}
	                        <a href="{php echo webUrl('sns/category/edit', array('id' => $row['id']))}" class="btn btn-default btn-sm" title="{ifp 'sns.category.edit'}修改{else}查看{/if}">
	                        	<i class="fa fa-edit"></i> {ifp 'sns.category.edit'}修改{else}查看{/if}
	                        </a>
                        {/if}
                        {ifp 'sns.category.delete'} 
                        	<a data-toggle='ajaxRemove' href="{php echo webUrl('sns/category/delete', array('id' => $row['id']))}"class="btn btn-default btn-sm" data-confirm="确认删除此分类?" title="删除"><i class="fa fa-trash"></i> 删除</a>
                        {/if}
                    </td>
                </tr>
                {/loop} 
            </tbody>
        </table>
        {$pager}
        {else}
        <div class='panel panel-default'>
            <div class='panel-body' style='text-align: center;padding:30px;'>
                暂时没有任何版块分类
            </div>
            {/if}


    </form>


    {template '_footer'}

